package o2o.config;

import com.jinyou.web.interceptor.ReqLangInterceptorAdapter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 拦截器配置类
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {

    @Bean
    public ReqLangInterceptorAdapter getReqLangInterceptorAdapter() {
        return new ReqLangInterceptorAdapter();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getReqLangInterceptorAdapter()).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
